<template>
  <el-card class="card">
      <br />
      <br />
      <br />
      <el-row>
        <el-col :span="24"
          ><span style="font-size: 0.1rem; margin-left: 0.55rem"
            >安全技术:</span
          >
          <span
            ><table class="table">
              <tr class="tr">
                <td class="th0" colspan="2" align="left">滩顶高程（m）</td>
                <td class="th" align="left">
                  <input
                    type="text"
                    style="
                      width: 2.5rem;
                      height: 4vh;
                      border: none;
                      outline: none;
                      font-size: 0.1rem;
                    "
                    v-model="addForm.beachTop"
                  />
                </td>
              </tr>
              <tr class="tr">
                <td class="th0" colspan="2" align="left">全库容（万m3）</td>
                <td class="th" align="left">
                  <input
                    type="text"
                    style="
                      width: 2.5rem;
                      height: 4vh;
                      border: none;
                      outline: none;
                      font-size: 0.1rem;
                    "
                    v-model="addForm.wholeLibrary"
                  />
                </td>
              </tr>
              <tr class="tr">
                <td class="th0" colspan="2" align="left">尾矿库等别</td>
                <td class="th" align="left">
                  <input
                    type="text"
                    style="
                      width: 2.5rem;
                      height: 4vh;
                      border: none;
                      outline: none;
                      font-size: 0.1rem;
                    "
                    v-model="addForm.tailingPond"
                  />
                </td>
              </tr>
              <tr class="tr">
                <td class="th0" colspan="2" align="left">筑坝方式</td>
                <td class="th" align="left">
                  <input
                    type="text"
                    style="
                      width: 2.5rem;
                      height: 4vh;
                      border: none;
                      outline: none;
                      font-size: 0.1rem;
                    "
                    v-model="addForm.damming"
                  />
                </td>
              </tr>
              <tr class="tr">
                <td class="th0" colspan="2" align="left">
                  尾矿坝的安全超高（m）
                </td>
                <td class="th" align="left">
                  <input
                    type="text"
                    style="
                      width: 2.5rem;
                      height: 4vh;
                      border: none;
                      outline: none;
                      font-size: 0.1rem;
                    "
                    v-model="addForm.security"
                  />
                </td>
              </tr>
              <tr class="tr">
                <td class="th0" colspan="2" align="left">干滩长度（m）</td>
                <td class="th" align="left">
                  <input
                    type="text"
                    style="
                      width: 2.5rem;
                      height: 4vh;
                      border: none;
                      outline: none;
                      font-size: 0.1rem;
                    "
                    v-model="addForm.dryBeach"
                  />
                </td>
              </tr>
              <tr class="tr">
                <td class="th0" colspan="2" align="left">浸润线埋深（m）</td>
                <td class="th" align="left">
                  <input
                    type="text"
                    style="
                      width: 2.5rem;
                      height: 4vh;
                      border: none;
                      outline: none;
                      font-size: 0.1rem;
                    "
                    v-model="addForm.line"
                  />
                </td>
              </tr>
              <tr class="tr">
                <td class="th0" align="left" rowspan="3">
                  尾矿坝最小抗滑稳定安全系数
                </td>
                <td class="th1" align="left">正常运行</td>
                <td class="th" align="left">
                  <input
                    type="text"
                    style="
                      width: 2.5rem;
                      height: 4vh;
                      border: none;
                      outline: none;
                      font-size: 0.1rem;
                    "
                    v-model="addForm.normal"
                  />
                </td>
              </tr>
              <tr class="tr">
                <td class="th1" align="left">洪水运行</td>
                <td class="th" align="left">
                  <input
                    type="text"
                    style="
                      width: 2.5rem;
                      height: 4vh;
                      border: none;
                      outline: none;
                      font-size: 0.1rem;
                    "
                    v-model="addForm.flood"
                  />
                </td>
              </tr>
              <tr class="tr">
                <td class="th1" align="left">特殊运行</td>
                <td class="th" align="left">
                  <input
                    type="text"
                    style="
                      width: 2.5rem;
                      height: 4vh;
                      border: none;
                      outline: none;
                      font-size: 0.1rem;
                    "
                    v-model="addForm.special"
                  />
                </td>
              </tr></table></span
        ></el-col>
      </el-row>
      <br />
      <br />
      <br />
      <br />
      <el-row>
        <el-col :span="24"
          ><span style="font-size: 0.1rem; margin-left: 0.75rem">综述:</span>
          <span
            ><table class="table1">
              <tr class="tr">
                <td class="td1" align="left">坝体稳定性</td>
                <td class="td" align="left">
                  <el-radio v-model="addForm.dam" label="1"
                    >满足设计要求
                  </el-radio>
                  <el-radio v-model="addForm.dam" label="0"
                    >不满足设计要求</el-radio
                  >
                </td>
              </tr>
              <tr class="tr">
                <td class="td1" align="left">防洪能力</td>
                <td class="td" align="left">
                  <el-radio v-model="addForm.controlFlood" label="1"
                    >满足设计要求</el-radio
                  >
                  <el-radio v-model="addForm.controlFlood" label="0"
                    >不满足设计要求</el-radio
                  >
                </td>
              </tr>
              <tr class="tr">
                <td class="td1" align="left">监测设施</td>
                <td class="td" align="left">
                  <el-radio v-model="addForm.monitor" label="1"
                    >满足设计要求</el-radio
                  >
                  <el-radio v-model="addForm.monitor" label="0"
                    >不满足设计要求</el-radio
                  >
                </td>
              </tr>
            </table></span
          ></el-col
        >
      </el-row>
      <br />
      <br />
      <br />
      <br />
      <el-row type="flex" justify="end">
        <el-col :span="5">
          <el-button type="primary" size="small" @click="keep()"
            >保存</el-button
          >
          <el-button type="primary" size="small">下载</el-button>
          <!-- <el-button type="primary" size="small" @click="upDown()"
          >下载</el-button
        > -->
        </el-col>
      </el-row>
  </el-card>
</template>

<script>
import {
  selectAnalysisReport,
  salveAnalysisReport,
} from "../../../api/risk-assessment";
import $ from "jquery";
export default {
  // name: "EvaluationReport",
  data() {
    return {
      tailingPondId:sessionStorage.getItem("sensorId"),
      addForm: {
        beachTop: "",
        wholeLibrary: "",
        tailingPond: "",
        damming: "",
        security: "",
        dryBeach: "",
        line: "",
        normal: "",
        flood: "",
        special: "",
        dam: "",
        controlFlood: "",
        monitor: "",
        tailingPondId: sessionStorage.getItem("sensorId"),
        id: "",
      },
    };
  },
  mounted() {
    this.getlist();
  },
  methods: {
    // 查询
    async getlist() {
      await selectAnalysisReport({
        tailingPondId: this.addForm.tailingPondId,
      }).then((res) => {
        console.log(res);
        if (res.resultCode == 200) {
          this.addForm.beachTop = res.parameter.beachTop;
          this.addForm.wholeLibrary = res.parameter.wholeLibrary;
          this.addForm.tailingPond = res.parameter.tailingPond;
          this.addForm.damming = res.parameter.damming;
          this.addForm.security = res.parameter.security;
          this.addForm.dryBeach = res.parameter.dryBeach;
          this.addForm.line = res.parameter.line;
          this.addForm.normal = res.parameter.normal;
          this.addForm.flood = res.parameter.flood;
          this.addForm.special = res.parameter.special;
          this.addForm.dam = res.parameter.dam;
          this.addForm.controlFlood = res.parameter.controlFlood;
          this.addForm.monitor = res.parameter.monitor;
          this.addForm.id = res.parameter.id;
        }
      });
    },
    // 保存
    async keep() {
      await salveAnalysisReport(this.addForm).then((res) => {
        if (res.resultCode == 200) {
          this.$message({
            message: "保存成功",
            type: "success",
            duration: 1000,
            offset: 450,
          });
        }
      });
    },
    //下载
    // upDown() {
    //   var params = new Array();
    //   var data = new Array();
    //   data["beachTop"] = this.addForm.beachTop;
    //   data["wholeLibrary"] = this.addForm.wholeLibrary;
    //   data["tailingPond"] = this.addForm.tailingPond;
    //   data["damming"] = this.addForm.damming;
    //   data["security"] = this.addForm.security;
    //   data["dryBeach"] = this.addForm.dryBeach;
    //   data["line"] = this.addForm.line;
    //   data["normal"] = this.addForm.normal;
    //   data["flood"] = this.addForm.flood;
    //   data["special"] = this.addForm.special;
    //   data["dam"] = this.addForm.dam;
    //   data["controlFlood"] = this.addForm.controlFlood;
    //   data["monitor"] = this.addForm.monitor;
    //   params["url"] =
    //     "http://10.200.1.2:8080/enterprise/analysis/exportAnalysisReport";
    //   params["method"] = "POST";
    //   params["data"] = data;
    //   this.DownLoadFile(params);
    // },
    // DownLoadFile(options) {
    //   // alert("hello world");
    //   var config = $.extend(true, { method: "post" }, options);
    //   var $iframe = $('<iframe id="down-file-iframe" />');
    //   var $form = $(
    //     '<form target="down-file-iframe" method="' + config.method + '" />'
    //   );
    //   $form.attr("action", config.url);
    //   for (var key in config.data) {
    //     $form.append(
    //       '<input type="hidden" name="' +
    //         key +
    //         '" value="' +
    //         config.data[key] +
    //         '" />'
    //     );
    //   }
    //   $iframe.append($form);
    //   $(document.body).append($iframe);
    //   $form[0].submit();
    //   $iframe.remove();
    // },
  },
};
</script>

<style scoped>
.card {
  height: 90.5vh;
  overflow: auto;
}
.el-button {
  font-size: 0.05rem;
}
.el-radio {
  font-size: 0.05rem;
}
.table {
  border: 1px solid black;
  font-size: 0.1rem;
  margin-left: 1.15rem;
  margin-top: -0.1rem;
  border-collapse: collapse;
}
.table1 {
  border: 1px solid black;
  font-size: 0.1rem;
  margin-left: 1.15rem;
  margin-top: -0.1rem;
  border-collapse: collapse;
}
.tr {
  height: 4vh;
  border: 1px solid black;
}

.th {
  width: 2.5rem;
  border: 1px solid black;
  padding-left: 0.07rem;
}
.th1 {
  width: 0.75rem;
  border: 1px solid black;
  padding-left: 0.07rem;
}
.th0 {
  width: 1.75rem;
  border: 1px solid black;
  padding-left: 0.07rem;
}
.td1 {
  width: 1.5rem;
  border: 1px solid black;
  padding-left: 0.07rem;
}
.td {
  width: 3.6rem;
  border: 1px solid black;
  padding-left: 0.07rem;
}
</style>